﻿using Compass.WmsService.Domain.Entities;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Zack.Infrastructure.EFCore;

namespace Compass.WmsService.Infrastructure;

public class WmsDbContext : BaseDbContext
{
    public DbSet<Vendor> Vendors { get; set; }
    public DbSet<Cargo> Cargoes { get; set; }
    public DbSet<Location> Locations { get; set; }

    public DbSet<Inventory> Inventories { get; set; }
    public DbSet<StockIn> StockIns { get; set; }
    public DbSet<StockOut> StockOuts { get; set; }
    

    public WmsDbContext(DbContextOptions<WmsDbContext> options, IMediator? mediator) : base(options, mediator)
    {
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        modelBuilder.ApplyConfigurationsFromAssembly(GetType().Assembly);
        modelBuilder.EnableSoftDeletionGlobalFilter();
    }
}